<template>
  <div class="page">
    <nav-top title='在线购买'>
      <div slot='right' @click="$router.push('/order-list/0')">我的订单</div>
    </nav-top>
    <page-content :inlineStyle="{paddingTop:'1.4rem'}">
      <product-list :proList='proList' v-if="proList.length> 0"></product-list>
    </page-content>
  </div>
</template>

<script>
import navTop from '@c/header/navTop'
import pageContent from '@c/pagecontent'
import productList from '@p/productList/productList'
import {
  proList
} from '../config/api.js'
export default {
  name: 'home',
  components: {
    navTop,
    pageContent,
    productList
    // XHeader
  },
  data() {
    return {
      proList: []
    }
  },
  methods: {

  },
  created() {

  },
  mounted(){
    proList((res) => {
      this.proList = res.data.data.itemList
    })

  },
  beforeRouteEnter: (to, from, next) => {
    let user_id = to.query.user_id
    console.log(user_id)
    next(vm => {
      vm.$store.commit('setUserId', user_id)
    })
  }

}

</script>

<style lang="scss">

</style>